package com.qidian.mes.machine.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.machine.service.MachineMaintainItemsService;
import com.qidian.mes.pojo.MaintainItems;
import com.sun.tools.javac.Main;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 任超
 * Time 2024/10/18 10:53
 */
@RestController
@RequestMapping("/items")
@CrossOrigin
public class MachineMaintainItemsController {
    @Autowired
    private MachineMaintainItemsService machineMaintainItemsService;

    @GetMapping("/list")
    public MESResult list(MaintainItems maintainItems  ,@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10")int limit){
        return machineMaintainItemsService.selectList(maintainItems,page,limit);
    }

    @PutMapping("/add")
    public MESResult addItem(@RequestBody MaintainItems maintainItems){
        return machineMaintainItemsService.addItems(maintainItems);
    }

    @PutMapping("/updateItems")
    public MESResult updateItems(@RequestBody MaintainItems maintainItems){
        return machineMaintainItemsService.updateItems(maintainItems);
    }

    @GetMapping("/selectById")
    public MESResult selectById(Long projectId){
        return machineMaintainItemsService.selectById(projectId);
    }

    @PutMapping("/updateStatus")
    public MESResult updateStatus(Long projectId){
        return machineMaintainItemsService.updateStatus(projectId);
    }
}
